import { BaseDTO, BaseMetadataWithPaginationDTO } from '@todo/core';
import { UserRoleDTO, UserRolePermissionDTO } from './user.dto.ts';
import { ROLE_TYPE } from '../config/enum.ts';

export interface requestUserRolesDTO {
  isActive?: string;
  type?: string;
  search?: string;
  perPage: string;
  page: string;
  orderBy: string;
  orderDirection: string;
}

export interface UserRoleEntityDTO {
  _id: string;
  description?: string;
  createdAt: string;
  updatedAt: string;
  name: string;
  isActive: boolean;
  type: ROLE_TYPE;
  permissions: number;
}

export interface UserRoleFilterDTO {
  isActive: boolean;
  type: string;
}

export interface responseUserRolesListDTO
  extends BaseMetadataWithPaginationDTO<UserRoleFilterDTO> {
  data: UserRoleEntityDTO[];
}

export interface responseUserRoleByID extends BaseDTO {
  data: UserRoleDTO;
}

export interface responsePermissionList extends BaseDTO {
  data: UserRolePermissionDTO[];
}

export interface responseCreateUpdateRole extends BaseDTO {
  data: {
    _id: string;
  };
}

export interface requestCreateRole {
  description: string;
  name: string;
  type: ROLE_TYPE;
  permissions: UserRolePermissionDTO[];
}

export type requestWOMeta = Omit<
  requestCreateRole,
  '_id' | 'createdAt' | 'updatedAt'
>;
